<template>
  <ych-modal
    :fullscreen="false"
    :title="title"
    :visible="visible"
    :destroyOnClose="true"
    @cancel="handleCancel">
    <a-tabs :tabPosition="tabPosition" size="small">
      <a-tabPane v-for="activity in activityList" :key="activity.id"
                 :tab="activity.name">
        <set-instance-users-data :target-activity-id="activity.id"
                                 :task-id="button.attribute.taskId" :operate-type="button.type"
                                 :process-instance-id="button.attribute.processInstanceId"></set-instance-users-data>
      </a-tabPane>
    </a-tabs>
    <template slot="footer">
      <a-button key="close" @click="handleCancel">{{ $t('m.common.button.close') }}</a-button>
    </template>
  </ych-modal>
</template>

<script>

  import SetInstanceUsersData from './SetInstanceUsersData';

  export default {
    name: "SetInstanceUsersDialog",
    components: {
      SetInstanceUsersData
    },
    props: {
      activityList: {
        type: Array,
        default: () => []
      },
      title: {
        type: String,
        default: null
      },
      button: {
        type: Object,
        default: () => {
        }
      }
    },
    data() {
      return {
        visible: false,
        tabPosition: "left",
      }
    },
    methods: {
      handleCancel() {
        this.visible = false;
      }
    }
  }
</script>
